<?php $posts = $this->getPosts(); ?>
<h1><?php echo $this->getCat()->getTitle();?>...</h1>
<p>Welcome to our gallery, please feel free to browse our images of the school and past events that have taken place.</p>
<ul class="gallery-list">
<?php 
$catcollection = Mage::getModel('imagegallery/cat')->getCollection()->addStoreFilter(Mage::app()->getStore()->getId());
$route = Mage::getStoreConfig('imagegallery/imagegallery/route');
if ($route == ""){
	$route = "imagegallery";
}
foreach($catcollection as $cat){
	echo '<li>';
	if($cat->getIdentifier()==$this->getCat()->getIdentifier()){
		echo '<b>'.$cat->getTitle().'</b>';
	}else{
		echo '<a href="'.Mage::getUrl($route . "/cat/") . $cat->getIdentifier().'">'.$cat->getTitle().'</a>';
	}
	echo '</li>';
}

?>
</ul>
<div class="clearboth"></div>
<div class="gallary">
	<?php 
	foreach ($posts as $post){
		echo '<a href="'.Mage::getBaseUrl('media').$post->getNfile().'" rel="lightbox">';
		echo '<img src="'.Mage::getModel('imageresize/imagemodel')->init(Mage::getBaseUrl('media').$post->getNfile())->resize(165,117).'" alt="'.$post->getTitle().'"/>';	
		echo '</a>';
	} 
	?>
	<div class="pager">
	<?php $this->getPages(); ?>
	</div>
</div>

